/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package disco;
import dominio.GestorClientes;
import dominio.Configuracion;
import dominio.GestorSesiones;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Serializable;

/**
 *
 * @author halt
 */
public class HandlerDisk implements Serializable{

    Disk hd;
    public HandlerDisk(){
        hd = new Disk();
    }
    /*utilizar serializable!*/
    public void salvarClientes(GestorClientes gc) {
        hd.escribirEnDisco("clientes.fdw", gc);
    }

    public GestorClientes cargarClientes() throws FileNotFoundException, IOException, ClassNotFoundException,NullPointerException {
        return (GestorClientes)hd.leerDeDisco("clientes.fdw");
    }

    public void salvarConfiguracion(Configuracion c){
        hd.escribirEnDisco("config.fdw", c);
    }

    public Configuracion cargarConfiguracion() throws FileNotFoundException, IOException, ClassNotFoundException {
        return (Configuracion)hd.leerDeDisco("config.fdw");
    }

    public void salvarSesiones(GestorSesiones gs){
        hd.escribirEnDisco("sesiones.fdw", gs);
    }

    public GestorSesiones cargarSesiones() throws FileNotFoundException, IOException, ClassNotFoundException{
        return (GestorSesiones)hd.leerDeDisco("sesiones.fdw");
    }
}
